// function Person () {
//     Person.prototype.name = "marry";
//     Person.prototype.sayName = function(){
//         console.log(this.name);
//     }
// }
 
// const person1 = new Person();
// const person2 = new Person();
// person1.sayName();                                        // marry
// person2.sayName();                                        // marry
// console.log(person1.sayName === person2.sayName);         // true
// const Person = function (name){
//     this.name = name
//     console.log('ok');
//     Person.prototype.say = function (){
//         console.log('我叫',this.name);
//     }
// }
function Person (name){
    this.name = name
    Person.prototype.say = function (){
        console.log('我叫',this.name);
    }
}
console.log(Person);
function Doctor (name){
    Doctor.prototype = Person.prototype
    Doctor.prototype.work = function (){
        console.log('我会做手术');
    }
}
const Person1 = new Person('李四')
console.log(Person1);
Person1.say()
const person2 = new Person('张三')
console.log(person2);
const Doctor1 = new Doctor('李四')
console.log(Doctor1);
// Doctor1.work()
const Doctor2 = new Doctor('李四')
Doctor2.work()
console.log(Doctor2);

